package com.zsummer.demo.cloudseataservice2;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

/**
 * @author zsummer
 * @since 2022/2/16
 */
@Repository
public class StockDao {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    public void deductStock(String productName, long orderCnt) {
        String sql = "update stock_msg set stock_cnt = stock_cnt - ? where product_name = ?";
        jdbcTemplate.update(sql, orderCnt, productName);
    }
}
